package com.SuanFa.lanqiao;

//二分法求递归求数组最大值
public class week3_2 {
    public static void main(String[] args) {
        int[]arr={2,34,6,54,25,48,36,8,6,9,10,66};
        System.out.println(process(arr,0,arr.length-1));
    }

    private static int process(int[] arr, int i, int i1) {
        if(i==i1){
            return arr[i];
        }
        int midNum = (i+i1)>>1;
        int leftNum = process(arr,i,midNum);
        int rightNum = process(arr,midNum+1,i1);
        return Math.max(leftNum,rightNum);
    }
}
